package com.liuzhilong.infrastructure.basic.singleton.doublecheck;

/**
 * 双重检查
 */
public class Singleton {
    private static volatile Singleton INSTACE=null;
    private Singleton(){

    }
    public static final Singleton getInstace(){
        if(INSTACE==null){
            synchronized (Singleton.class){
                if(INSTACE==null){
                    INSTACE = new Singleton();
                }
            }
        }
        return INSTACE;
    }
    public void doSomething(){
        System.out.println(this.getClass().getName());
    }
}
